const bcrypt = require("bcrypt");
module.exports = (db, DataTypes) => {
  return db.define(
    "Admin",
    {
      id: {
        type: DataTypes.INTEGER.UNSIGNED,
        autoIncrement: true,
        primaryKey: true,
      },
      username: {
        type: DataTypes.STRING,
      },
      password: {
        type: DataTypes.STRING,
        set(val) {
          return bcrypt.hashSync(val, 10);
        },
      },
      status: {
        type: DataTypes.INTEGER.UNSIGNED,
      },
    },
    {
      timestamps: false,
      tableName: "admins",
    }
  );
};
